﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Delete_Adapter
{
    class Program
    {
        static void Main(string[] args)
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString="Data Source=(local);Initial Catalog=sale; User Id=sa; Password=sa";                 
            SqlDataAdapter da = new SqlDataAdapter();
            SqlCommand secmd = new SqlCommand("select * from customers", conn);  
            SqlCommand decmd = new SqlCommand("delete from customers where id = @id",conn);
            decmd.Parameters.Add("@id", SqlDbType.Int, 4, "id");
            da.SelectCommand = secmd;
            da.DeleteCommand = decmd;
            DataSet ds = new DataSet();
            da.Fill(ds, "customers");
            DataTable dt = ds.Tables["customers"];
            dt.Rows[1].Delete();
            da.Update(ds, "customers"); 
        }
    }
}
